home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat5 / pthreads.z / pthreads
Encoding:
Text File  |  2001-04-17  |  26.2 KB  |  463 lines

  1.  
  2.  
  3.  
  4. pppptttthhhhrrrreeeeaaaaddddssss((((5555))))                                                        pppptttthhhhrrrreeeeaaaaddddssss((((5555))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      pthreads - introduction to POSIX thread characteristics
  10.  
  11. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  12.      This man page is intended as an overview of the POSIX thread model as
  13.      implemented in IRIX; it is not an introduction to thread programming or a
  14.      detailed description of the IRIX implementation.
  15.  
  16.      Thread programming is motivated by two concerns:
  17.  
  18.      AAAApppppppplllliiiiccccaaaattttiiiioooonnnn PPPPeeeerrrrffffoooorrrrmmmmaaaannnncccceeee
  19.           +o   On a multiprocessor multiple threads may run at the same time.
  20.           +o   Operations that cause the caller to wait do not prevent other
  21.               threads (in the same process) from making progress.
  22.  
  23.      PPPPrrrrooooggggrrrraaaammmmmmmmiiiinnnngggg MMMMooooddddeeeellll
  24.           +o   Complex applications can be structured more elegantly by
  25.               partitioning with threads.
  26.           +o   Threads share many resources implicitly which can simplify co-
  27.               operative algorithms.
  28.  
  29.      In the past a UNIX process has been thought of as having a single thread.
  30.      The POSIX thread programming model (known as _p_t_h_r_e_a_d_s) introduces the
  31.      concept of multiple threads within a single process.  A POSIX thread is
  32.      an executable entity that belongs to a process.  It contains sufficient
  33.      state to enable it to run on a processor independently of its fellows.
  34.      In most other respects threads share state with their host process.  The
  35.      vast majority of interfaces and features work the same way in a multi-
  36.      threaded process as an unthreaded one.
  37.  
  38.      The POSIX threads API provides a set of interfaces and semantics for
  39.      creating and controlling threads.  Because the interfaces are defined by
  40.      the ISO standards organisation an application using them may enjoy the
  41.      benefits of parallel programming without sacrificing portability.
  42.  
  43.    AAAApppppppplllliiiiccccaaaattttiiiioooonnnnssss
  44.      To create a pthread process an application must be linked with the
  45.      pthread run-time library.  It is also recommended that the thread safe
  46.      options be enabled at compile time using the feature test macro,
  47.      ____PPPPOOOOSSSSIIIIXXXX____CCCC____SSSSOOOOUUUURRRRCCCCEEEE.
  48.  
  49.           cc -D_POSIX_C_SOURCE=199506L app.c -llib0 -llib1 ... -lpthread
  50.  
  51.      See _i_n_t_r_o(3), section 3P for further details.
  52.  
  53.    CCCCoooommmmppppoooonnnneeeennnnttttssss
  54.      POSIX threads introduces a number of thread components.
  55.  
  56.      AAAAttttttttrrrriiiibbbbuuuutttteeee
  57.           An attribute is a characteristic of something that defines its
  58.           behaviour.  Most of the objects introduced by pthreads have
  59.           characteristics which are set when it is created; indeed some
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. pppptttthhhhrrrreeeeaaaaddddssss((((5555))))                                                        pppptttthhhhrrrreeeeaaaaddddssss((((5555))))
  71.  
  72.  
  73.  
  74.           characteristics may only be set at that time.  A set of
  75.           characteristics may be specified in an attribute object which is
  76.           passed to the creation interface.  An analogy is a mould or template
  77.           that is used to shape some artifact.  Every attribute has a default
  78.           value and the attribute object itself is optional.
  79.  
  80.      TTTThhhhrrrreeeeaaaadddd
  81.           A thread executes code.  It is created using _p_t_h_r_e_a_d__c_r_e_a_t_e() and
  82.           either inherits characteristics from its creator or has them
  83.           specified via creation attributes.  The _p_t_h_r_e_a_d__a_t_t_r_* interfaces
  84.           may be used to create a thread attributes object.
  85.           Many features of the process are shared by its threads, including
  86.           process and user ids (PID, UID), file descriptors, memory (including
  87.           text and data) and signal handlers.
  88.           Each thread has a unique identity which is used by a number of
  89.           pthread interfaces.  Thread ids may be compared using
  90.           _p_t_h_r_e_a_d__e_q_u_a_l().
  91.           Threads terminate with an exit status [see _p_t_h_r_e_a_d__e_x_i_t()].  By
  92.           default the thread identity and exit status persist after the thread
  93.           has terminated until the status is retrieved using _p_t_h_r_e_a_d__j_o_i_n().
  94.           An application should either retrieve this status or arrange for it
  95.           to be automatically discarded on thread termination using
  96.           _p_t_h_r_e_a_d__d_e_t_a_c_h() or setting the detach thread attribute.
  97.  
  98.      MMMMuuuutttteeeexxxx LLLLoooocccckkkk
  99.           A mutex lock facilitates exclusive access by a thread to a resource.
  100.           Only one thread may own a mutex at a time and is thus guaranteed
  101.           exclusive access.
  102.           Mutex interfaces are described on the _p_t_h_r_e_a_d__m_u_t_e_x_* man pages.
  103.           The _p_t_h_r_e_a_d__m_u_t_e_x_a_t_t_r_* interfaces may be used to create a mutex
  104.           attributes object.  Attributes include error checking, recursion and
  105.           owner priority.  Mutexes are intended to be lightweight and only
  106.           owned for brief periods of time.
  107.  
  108.      CCCCoooonnnnddddiiiittttiiiioooonnnn VVVVaaaarrrriiiiaaaabbbblllleeee
  109.           A condition variable synchronises threads with an event of interest.
  110.           Condition variables allow a thread to wait for an event and be woken
  111.           up when the event occurs; the nature of the event is determined by
  112.           the application.
  113.           Condition variable interfaces are described on the _p_t_h_r_e_a_d__c_o_n_d_*
  114.           man pages.  The _p_t_h_r_e_a_d__c_o_n_d_a_t_t_r_* interfaces may be used to create
  115.           a condition variable attributes object.
  116.  
  117.      RRRReeeeaaaadddd----WWWWrrrriiiitttteeee LLLLoooocccckkkk
  118.           A read-write lock facilitates shared access for read and exclusive
  119.           access for write by threads to a resource.  They are used in
  120.           conjunction with resources which are frequently read but
  121.           infrequently changed (written).
  122.           Read-write lock interfaces are described on the _p_t_h_r_e_a_d__r_w_l_o_c_k_* man
  123.           pages.  The _p_t_h_r_e_a_d__r_w_l_o_c_k_a_t_t_r_* interfaces may be used to create a
  124.           read-write lock attributes object.
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. pppptttthhhhrrrreeeeaaaaddddssss((((5555))))                                                        pppptttthhhhrrrreeeeaaaaddddssss((((5555))))
  137.  
  138.  
  139.  
  140.      SSSSeeeemmmmaaaapppphhhhoooorrrreeee
  141.           A semaphore synchronises threads with a counter.  Semaphores are not
  142.           part of pthreads per se and do not have an associated attributes
  143.           object.  However anonymous semaphores provide a _p_s_h_a_r_e_d flag (for
  144.           semaphores which are private to the process) which allows pthreads
  145.           to optimise access [see _s_e_m__i_n_i_t(3C)].  Semaphore interfaces are
  146.           described on the _s_e_m_* man pages.
  147.  
  148.    SSSSeeeemmmmaaaannnnttttiiiiccccssss
  149.      POSIX threads introduces the following special semantics.
  150.  
  151.      CCCCaaaannnncccceeeellllllllaaaattttiiiioooonnnn
  152.           A cancellation request is a request for a thread to terminate.  Each
  153.           thread specifies whether and when to act on cancellation requests
  154.           using its cancelability state and type.  A request is made with
  155.           _p_t_h_r_e_a_d__c_a_n_c_e_l() and the state and type are set with
  156.           _p_t_h_r_e_a_d__s_e_t_c_a_n_c_e_l_s_t_a_t_e() and _p_t_h_r_e_a_d__s_e_t_c_a_n_c_e_l_t_y_p_e().  Termination
  157.           handlers may be established to execute code when a thread terminates
  158.           for some reason including acting on a cancellation request.
  159.  
  160.      SSSSiiiiggggnnnnaaaallllssss
  161.           In the pthread signal model all threads share the signal disposition
  162.           [see _s_i_g_a_c_t_i_o_n(2)] but each thread has its own signal mask of
  163.           blocked signals.  Signals may be sent to individual threads using
  164.           the _p_t_h_r_e_a_d__k_i_l_l() interface.  Each thread may change its own mask
  165.           using _p_t_h_r_e_a_d__s_i_g_m_a_s_k().  In IRIX, _s_i_g_p_r_o_c_m_a_s_k(2) is equivalent to
  166.           _p_t_h_r_e_a_d__s_i_g_m_a_s_k() but a portable pthread application should only use
  167.           the latter.
  168.           A signal is delivered to at most one thread; it is not broadcast to
  169.           all threads.
  170.  
  171.           +o   When a signal is directed at a process the first eligible thread
  172.               is chosen to receive it.  An eligible thread is one that does
  173.               not have the signal blocked in its signal mask or is waiting in
  174.               _s_i_g_w_a_i_t(3).  If there are no eligible threads then the signal
  175.               remains pending on the process until a thread becomes eligible.
  176.               This is called asynchronous signal delivery; _k_i_l_l(2) causes this
  177.               type of delivery.
  178.  
  179.           +o   When a signal is directed at a thread then that thread will
  180.               receive it.  If the signal is blocked then it will remain
  181.               pending on the target thread; it will not be delivered to a
  182.               different thread.  This is called synchronous signal delivery;
  183.               exceptions and program faults cause this type of delivery.
  184.  
  185.           +o   If the action of the signal is to stop, continue or terminate
  186.               the recipient then it will act on the process as a whole.  It is
  187.               not possible to stop, continue or terminate a single thread with
  188.               a signal.
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. pppptttthhhhrrrreeeeaaaaddddssss((((5555))))                                                        pppptttthhhhrrrreeeeaaaaddddssss((((5555))))
  203.  
  204.  
  205.  
  206.      NNNNoooottttiiiiffffiiiiccccaaaattttiiiioooonnnnssss
  207.           An extension to signal handling for threads is the addition of
  208.           SSSSIIIIGGGGEEEEVVVV____TTTTHHHHRRRREEEEAAAADDDD which creates a thread instead of sending a signal as a
  209.           means of handling the occurrence of some event [see _m_q__n_o_t_i_f_y(3C),
  210.           _a_i_o__r_e_a_d(3) and _t_i_m_e_r__c_r_e_a_t_e(3C)].  Creation of the thread takes
  211.           place when the event occurs so care should be taken to avoid any
  212.           errors or else the notification may be lost.
  213.  
  214.      SSSScccchhhheeeedddduuuulllliiiinnnngggg
  215.           When a processor executes instructions on behalf of a user it does
  216.           so according to a set of scheduling attributes which are part of a
  217.           kernel _e_x_e_c_u_t_i_o_n _v_e_h_i_c_l_e.  Every thread that executes on a processor
  218.           or waits in the kernel needs such a vehicle.
  219.  
  220.           POSIX threads makes a distinction between system scope (kernel)
  221.           scheduling and process scope (run-time) scheduling. The SGI
  222.           implementation adds an additional scheduling scope, bound scope.
  223.           These bound scope threads are scheduled exactly the same as POSIX
  224.           process scope threads.  For the rest of this man page, the
  225.           discussion of process scope scheduling is applicable for bound scope
  226.           threads.  In both scopes the individual thread scheduling policy and
  227.           priority values are set using the interfaces
  228.           _p_t_h_r_e_a_d__a_t_t_r__s_e_t_s_c_h_e_d_p_o_l_i_c_y(), _p_t_h_r_e_a_d__a_t_t_r__s_e_t_s_c_h_e_d_p_a_r_a_m(), and
  229.           _p_t_h_r_e_a_d__s_e_t_s_c_h_e_d_p_a_r_a_m().
  230.  
  231.           Scope is defined when a thread is created using
  232.           _p_t_h_r_e_a_d__a_t_t_r__s_e_t_s_c_o_p_e():
  233.  
  234.           ssssyyyysssstttteeeemmmm ssssccccooooppppeeee threads are scheduled by the kernel; the scheduling
  235.           attributes of the thread and the kernel execution vehicle are the
  236.           same.  The kernel includes all system scope threads in its
  237.           scheduling decisions.  These threads run at realtime policy and
  238.           priority and may only be created by privileged users.
  239.  
  240.           pppprrrroooocccceeeessssssss ssssccccooooppppeeee threads are scheduled by the pthread run-time; the
  241.           scheduling attributes of the thread and the kernel execution vehicle
  242.           may be different.  The run-time makes scheduling decisions based
  243.           only on the process scope threads in the host process.
  244.  
  245.           An advantage of system scope is that a thread can get high
  246.           performance and deterministic response.  A disadvantage is that
  247.           kernel resources must be allocated to each thread.
  248.  
  249.           In contrast, process scope threads only require kernel state when
  250.           they are executing on a processor or waiting in the kernel.  The
  251.           run-time scheduler multiplexes process scope threads onto a smaller
  252.           number of kernel execution vehicles.  This can produce faster
  253.           scheduling because no kernel state is involved.
  254.  
  255.           The number of execution vehicles used for process scope threads
  256.           depends on application behaviour and system configuration.  By
  257.           default, the run-time adjusts this number dynamically but the
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. pppptttthhhhrrrreeeeaaaaddddssss((((5555))))                                                        pppptttthhhhrrrreeeeaaaaddddssss((((5555))))
  269.  
  270.  
  271.  
  272.           _p_t_h_r_e_a_d__s_e_t_c_o_n_c_u_r_r_e_n_c_y() interface gives a strong hint as to the
  273.           desired value.
  274.  
  275.           The execution vehicles used for process scope threads share a set of
  276.           kernel scheduling attributes which can be changed using the
  277.           _s_c_h_e_d__s_e_t_s_c_h_e_d_u_l_e_r() and _s_c_h_e_d__s_e_t_p_a_r_a_m() interfaces.  These
  278.           interfaces do not affect system scope thread scheduling.  As with
  279.           system scope threads changing these scheduling attributes is a
  280.           privileged operation.
  281.  
  282.      LLLLoooowwww----oooovvvveeeerrrrhhhheeeeaaaadddd LLLLoooocccckkkkiiiinnnngggg
  283.           In order to protect updates to internal pthread data structures, a
  284.           low-overhead locking mechanism is required.  This locking interface
  285.           is not user-callable and is contained entirely within the pthread
  286.           library.  When pthreads are present, this locking mechanism is also
  287.           used to ensure that some routines in libc can be safely called from
  288.           multiple threads.  Some examples of this are the _s_t_d_i_o(3S) routines
  289.           and the _m_a_l_l_o_c(3C) routines.
  290.  
  291.           By default, these locks spin/sleep for pppprrrroooocccceeeessssssss ssssccccooooppppeeee and bbbboooouuuunnnndddd ssssccccooooppppeeee
  292.           threads on multiprocessor systems, and immediately block for ssssyyyysssstttteeeemmmm
  293.           ssssccccooooppppeeee threads and on single processor systems.  In the spin/sleep
  294.           lock path, the lock will be tried 1000 times, and then _n_a_n_o_s_l_e_e_p(2)
  295.           will be called.  This process will be repeated until the lock can be
  296.           obtained.
  297.  
  298.           This process can be tuned for an individual application with the
  299.           PPPPTTTT____SSSSPPPPIIIINNNNSSSS environment variable.  This determines how many times the
  300.           lock is tried before sleeping.  This environment variable is checked
  301.           once at program startup time.  Different spin values may be used to
  302.           improve application throughput; however, higher values will probably
  303.           increase user time while lower values will probably increase system
  304.           time.  In general, applications with more pthreads than processors
  305.           will probably benefit from setting PPPPTTTT____SSSSPPPPIIIINNNNSSSS to a lower value, while
  306.           applications with fewer pthreads may benefit from setting the
  307.           environment variable to a higher value.  If the environment variable
  308.           is set to 0, these locks will all become blocking locks.
  309.           _r_e_a_l_t_i_m_e(5) applications and applications that create only ssssyyyysssstttteeeemmmm
  310.           ssssccccooooppppeeee threads may benefit from setting PPPPTTTT____SSSSPPPPIIIINNNNSSSS to 0.  This forces
  311.           the locks to block immediately instead of having the lock routine do
  312.           a run-time check to determine if the caller is a ssssyyyysssstttteeeemmmm ssssccccooooppppeeee
  313.           thread.
  314.  
  315.      TTTThhhhrrrreeeeaaaadddd DDDDaaaattttaaaa
  316.           Pthreads share the address space; stacks, text and data are
  317.           accessible by all threads in the process.  This means that access to
  318.           shared data is simpler than where multiple processes use a shared
  319.           memory region which each must map.  The cost is the potential for
  320.           accidental corruption.  Individual thread data is provided using the
  321.           notion of a shared set of keys and unique thread values bound to
  322.           each key.  The _p_t_h_r_e_a_d__k_e_y__c_r_e_a_t_e() interface creates a new, shared
  323.           key and _p_t_h_r_e_a_d__s_e_t_s_p_e_c_i_f_i_c() allows a thread to bind its own value
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. pppptttthhhhrrrreeeeaaaaddddssss((((5555))))                                                        pppptttthhhhrrrreeeeaaaaddddssss((((5555))))
  335.  
  336.  
  337.  
  338.           to a key.  Conceptually, the key is an index to an array of values.
  339.           The same key used by different threads may retrieve a different
  340.           values because each thread has its own array.
  341.  
  342.      PPPPrrrroooocccceeeessssssss MMMMaaaannnnaaaaggggeeeemmmmeeeennnntttt
  343.           Some basic UNIX interfaces have particular semantics when called
  344.           from a POSIX threads process.
  345.  
  346.           ffffoooorrrrkkkk((((2222)))) creates a new pthread process and follows the usual rules
  347.           for inherited state.  The new process has a single pthread (the one
  348.           which made the call); all other pthreads active prior to _f_o_r_k() are
  349.           quietly destroyed and their resources (stacks etc.) reclaimed by the
  350.           pthread run-time.  A number of issues arise because _f_o_r_k() causes
  351.           data to be copied from the parent to the child with no
  352.           synchronisation with threads that may be modifying that data.  To
  353.           allow the application to perform its own synchronisation the
  354.           _p_t_h_r_e_a_d__a_t_f_o_r_k() interface can register handlers to be processed
  355.           when _f_o_r_k() is used.  In general operations which are safe to
  356.           perform after a _f_o_r_k() are the same as those which are safe to
  357.           perform in a signal handler.
  358.  
  359.           eeeexxxxeeeecccc((((2222)))) overlays a new process image on the calling process; all
  360.           threads from the old image are destroyed.  Thread termination
  361.           handlers and thread data destruction  [see _p_t_h_r_e_a_d__c_l_e_a_n_u_p__p_u_s_h()
  362.           and _p_t_h_r_e_a_d__k_e_y__c_r_e_a_t_e()] are not performed.  The new process will
  363.           only be a pthread process if the new image is of a pthread process.
  364.  
  365.           eeeexxxxiiiitttt((((2222)))) performs all the usual process clean up operations and then
  366.           destroys all threads in the process.  Thread termination handlers
  367.           and thread data destruction  [see _p_t_h_r_e_a_d__c_l_e_a_n_u_p__p_u_s_h() and
  368.           _p_t_h_r_e_a_d__k_e_y__c_r_e_a_t_e()] are not performed.
  369.  
  370.    LLLLiiiimmmmiiiittttaaaattttiiiioooonnnnssss
  371.      With POSIX threads there are some limitations and practices to avoid.
  372.  
  373.      NNNNooootttt eeeennnnoooouuuugggghhhh pppptttthhhhrrrreeeeaaaaddddssss
  374.           Each pthread process has a resource limit called RRRRLLLLIIIIMMMMIIIITTTT____PPPPTTTTHHHHRRRREEEEAAAADDDD on
  375.           the number of threads it can create.  The value is inherited by
  376.           child processes and may be set using _s_e_t_r_l_i_m_i_t(2) or the shell _l_i_m_i_t
  377.           and _u_l_i_m_i_t commands.  The default limits can be changed using the
  378.           _s_y_s_t_u_n_e(1M) command on the _r_l_i_m_i_t__p_t_h_r_e_a_d__c_u_r and _r_l_i_m_i_t__p_t_h_r_e_a_d__m_a_x
  379.           variables.
  380.  
  381.      FFFFaaaattttaaaallll eeeexxxxcccceeeeppppttttiiiioooonnnnssss
  382.           When a thread executes code in the pthread run-time scheduler it
  383.           masks signals so that signal handlers always run in a consistent
  384.           environment.  A side effect of this is that if the thread raises an
  385.           exception (for example due to memory corruption) the kernel will
  386.           terminate the process.  As an aid to debugging such problems the
  387.           environment variable PPPPTTTT____CCCCOOOORRRREEEE should be set prior to starting the
  388.           application so that a core file will be generated.
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. pppptttthhhhrrrreeeeaaaaddddssss((((5555))))                                                        pppptttthhhhrrrreeeeaaaaddddssss((((5555))))
  401.  
  402.  
  403.  
  404.      SSSSttttaaaacccckkkk oooovvvveeeerrrrrrrruuuunnnn
  405.           Unlike the default stack in an unthreaded IRIX process, pthread
  406.           stacks are limited [see _p_t_h_r_e_a_d__a_t_t_r__s_e_t_s_t_a_c_k_s_i_z_e()] and a thread
  407.           may overrun its stack.  By default pthread stacks have a protected
  408.           region at the end of the stack [see _p_t_h_r_e_a_d__a_t_t_r__s_e_t_g_u_a_r_d_s_i_z_e()]
  409.           that can turn some of these overruns into a protection faults which
  410.           is generally preferable to overwriting data.
  411.  
  412.      DDDDyyyynnnnaaaammmmiiiicccc llllooooaaaaddddiiiinnnngggg
  413.           The pthread library can be made available to a running process. The
  414.           pthread DSO can be dynamically loaded using _d_l_o_p_e_n(3C) or
  415.           _s_g_i_d_l_a_d_d(3C).  Any pthread calls made before pthread library is
  416.           loaded will all return ENOSYS.
  417.  
  418.      UUUUssssiiiinnnngggg sssspppprrrrooooccccssss
  419.           The _s_p_r_o_c(2) model of threading is incompatible with POSIX threads.
  420.           Attempts by an sproc process to create pthreads and vice-versa will
  421.           be rejected.
  422.  
  423.      PPPPrrrriiiioooorrrriiiittttyyyy
  424.           Attempts to create a pthread process at a priority outside of the
  425.           valid range will be rejected [see _s_c_h_e_d__g_e_t__p_r_i_o_r_i_t_y__m_i_n(_2) and
  426.           _s_c_h_e_d__g_e_t__p_r_i_o_r_i_t_y__m_a_x(_2)].  Specifically, _w_e_i_g_h_t_l_e_s_s is not a valid
  427.           pthread priority.
  428.  
  429.      MMMMAAAAPPPP____LLLLOOOOCCCCAAAALLLL mmmmeeeemmmmoooorrrryyyy
  430.           The POSIX thread memory model requires that memory be available to
  431.           all threads.  The MMMMAAAAPPPP____LLLLOOOOCCCCAAAALLLL option to _m_m_a_p(2) is useful only to
  432.           sproc processes and should not be used with pthreads.
  433.  
  434.      DDDDyyyynnnnaaaammmmiiiicccc mmmmeeeemmmmoooorrrryyyy aaaallllllllooooccccaaaattttiiiioooonnnn
  435.           The _s_b_r_k(2) call is not thread-safe.  It is used by the C run-time
  436.           memory allocator, _m_a_l_l_o_c(3C), which is always used by the pthread
  437.           run-time.  Safe use of _s_b_r_k(2) outside of the run-time (for example
  438.           by a third party memory allocator) is not therefore possible.
  439.  
  440.    DDDDooooccccuuuummmmeeeennnnttttaaaattttiiiioooonnnn
  441.      Additional on-line documentation about pthreads is available in:
  442.           _T_o_p_i_c_s _i_n _I_R_I_X _P_r_o_g_r_a_m_m_i_n_g: _C_h_a_p_t_e_r _1_3
  443.           _S_p_e_e_d_S_h_o_p _U_s_e_r'_s _G_u_i_d_e: _C_h_a_p_t_e_r _6
  444.  
  445. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  446.      pthread_*(3P)
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.                                                                         PPPPaaaaggggeeee 7777
  460.  
  461.  
  462.  
  463.